﻿using System;
using System.Collections.Generic;
using Eamon.MeituanDotnetSDK.api.oauth.@enum;

namespace Eamon.MeituanDotnetSDK.api.common.request
{
    public abstract class BaseOAuthRequest : IAPIRequest
    {
        public BaseOAuthRequest()
        {
        }

        private int businessId;
        /// <summary>
        /// 业务类型Id，业务ID列表，必填
        /// https://developer.meituan.com/docs/biz/comm-dev-isv-api-rule
        /// </summary>
        public int BusinessId
        {
            get { return businessId; }
        }


        public BaseOAuthRequest(int businessId)
        {
            this.businessId = businessId;
        }

        public abstract Dictionary<string, object> toParams();


        protected static string GetGrantTypeEnumValue(GrantType grantType)
        {
            switch (grantType)
            {
                case GrantType.AUTHORIZE_PLATFORM:
                    return "authorize_platform";
                case GrantType.REFRESH_TOKEN:
                    return "refresh_token";
                case GrantType.AUTHORIZATION_CODE:
                    return "authorization_code";
                default:
                    return "";
            }
        }
    }
}
